package o;

import android.app.Activity;
import android.content.Context;
import com.huawei.appgallery.forum.user.api.OpenRealNameCheckerAction;
import com.huawei.appgallery.forum.user.api.OpenRealNameCheckerAction.a;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.hwid.core.constants.HwAccountConstants;

public class cbp extends cfh {
    private boolean ॱ;

    public cbp(Context context, boolean z) {
        this.context = context;
        this.ॱ = z;
    }

    public void doCheck() {
        if (ˏ()) {
            final cut o_cut = (cut) fho.ˏ().ˋ("RealName").ॱ(cut.class);
            if (this.context instanceof Activity) {
                final Activity activity = (Activity) this.context;
                if (this.ॱ) {
                    ˎ(activity);
                    return;
                } else {
                    o_cut.ˊ(activity, new cul(this) {
                        final /* synthetic */ cbp ˋ;

                        public void ˊ(int i) {
                            if (i == 1) {
                                this.ˋ.checkSuccess();
                                return;
                            }
                            o_cut.ˋ(activity, new cuu(this) {
                                final /* synthetic */ AnonymousClass4 ˎ;

                                {
                                    this.ˎ = r1;
                                }

                                public void ˎ(int i) {
                                    if (i == 1001) {
                                        this.ˎ.ˋ.checkSuccess();
                                    } else {
                                        this.ˎ.ˋ.checkFailed();
                                    }
                                }
                            });
                            bsc.ˋ().ˊ(Long.valueOf(System.currentTimeMillis()));
                        }
                    });
                    return;
                }
            }
            checkSuccess();
            return;
        }
        checkSuccess();
    }

    private void ˎ(final Activity activity) {
        OpenRealNameCheckerAction.setOpenCallBack(new a(this) {
            final /* synthetic */ cbp ˊ;

            public void ॱ(int i, cut o_cut) {
                if (i == 1) {
                    this.ˊ.checkSuccess();
                    return;
                }
                o_cut.ˋ(activity, new cuu(this) {
                    final /* synthetic */ AnonymousClass3 ˋ;

                    {
                        this.ˋ = r1;
                    }

                    public void ˎ(int i) {
                        if (i == 1001) {
                            this.ˋ.ˊ.checkSuccess();
                        } else {
                            this.ˋ.ˊ.checkFailed();
                        }
                    }
                });
                bsc.ˋ().ˊ(Long.valueOf(System.currentTimeMillis()));
            }
        });
    }

    public String getName() {
        return "RealNameChecker";
    }

    public boolean ॱ() {
        Long L_ = bsc.ˋ().L_();
        return L_.longValue() > 0 && System.currentTimeMillis() - L_.longValue() <= HwAccountConstants.CHECK_SITE_COUNTRY_DURATION;
    }

    private boolean ˏ() {
        return "CN".equalsIgnoreCase(UserSession.getInstance().getHomeCountry());
    }
}
